package com.dom.domweb.modular.shiro;

import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
import org.apache.shiro.web.util.WebUtils;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

/**
 * @Description 自定义认证过滤器
 * @Author xllei
 * @Date 2018/11/17 10:35 PM
 * @Version 1.0
 **/
public class MyFormAuthenticationFilter extends FormAuthenticationFilter {
    private static String url = "/index";
    @Override
    protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest request, ServletResponse response) throws Exception {
//        return super.onLoginSuccess(token, subject, request, response);
        WebUtils.redirectToSavedRequest(request, response, url);
        return true;
    }
}
